﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace NCEdu.Web.Attendance
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtAttendanceId.Text))
			{
				strErr+="AttendanceId格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtstuNo.Text))
			{
				strErr+="stuNo格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtAttendanceState.Text))
			{
				strErr+="AttendanceState格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int AttendanceId=int.Parse(this.txtAttendanceId.Text);
			int stuNo=int.Parse(this.txtstuNo.Text);
			int AttendanceState=int.Parse(this.txtAttendanceState.Text);
			bool AttendanceStlye=this.chkAttendanceStlye.Checked;

			NCEdu.Model.Attendance model=new NCEdu.Model.Attendance();
			model.AttendanceId=AttendanceId;
			model.stuNo=stuNo;
			model.AttendanceState=AttendanceState;
			model.AttendanceStlye=AttendanceStlye;

			NCEdu.BLL.Attendance bll=new NCEdu.BLL.Attendance();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
